﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="KnowledgePointTree.ascx.cs"
    Inherits="YiShi.KnowledgePoint.KnowledgePointTree" %>
<div style="<%=Width==0?"": "width:" + Width + "px;" %><%=Height==0?"":"height:" + Height + "px;" %>overflow:auto;">
    <table style="width: 100%; border-collapse: collapse; background-color: #d0e5f5;"
        class="single-border">
        <%=tr %>
        <tr class="table-body" align="center">
            <td class="single-border" style="width: 20px;">
            </td>
            <td class="single-border">
                概念
            </td>
        </tr>
        <%=html %>
    </table>
</div>
<div style="display: none;">
    <button name="ExpandButton" style="font-size: 0pt;" id="ExpandButtonTemplate">
        <span class="ui-icon ui-icon-minusthick"></span>
    </button>
</div>

<script language="javascript">
    $(function event() {
        //Init
        $("button[name='ExpandButton']").button();
        $("button[name='ExpandButton']").click(function() {
            var $tr = $(this).parents("tr:first");
            var level = $tr.attr("level");
            var $trs = new Array();
            $tr = $tr.next();
            while ($tr.length != 0 && parseInt($tr.attr("level")) > level) {
                $trs[$trs.length] = $tr;
                $tr = $tr.next();
            }
            var $child = $(this).find(".ui-icon-plusthick, .ui-icon-minusthick");
            if ($child.hasClass("ui-icon-plusthick")) {
                $child.removeClass("ui-icon-plusthick").addClass("ui-icon-minusthick");
                for (var i = 0; i < $trs.length; i++) {
                    $trs[i].css("display", "");
                    var $ele = $trs[i].find(".ui-icon-plusthick");
                    if ($ele.length != 0)
                        $ele.removeClass("ui-icon-plusthick").addClass("ui-icon-minusthick");
                }
            }
            else {
                $child.removeClass("ui-icon-minusthick").addClass("ui-icon-plusthick");
                for (var i = 0; i < $trs.length; i++)
                    $trs[i].css("display", "none");

            }
        });
    });
</script>

